import time

def s(a):
    swaped = True
    while swaped:
        swaped = False
        for i in range(len(a) - 1):
                if a[i] > a[i + 1]:
                    a[i], a[i + 1] = a[i + 1], a[i]
                    swaped = True
                    
def read(filename):
    file = open(filename, "r")
    data = file.readlines()
    return data

m1 = read("m1_sorted.txt")
m2 = read("m2_reverse.txt")
m3 = read("m3_shuffle.txt")

ts = time.time()
s(m1)
tf = time.time()
print(round(tf - ts) * 1000)

ts = time.time()
s(m2)
tf = time.time()
print(round(tf - ts) * 1000)

ts = time.time()
s(m3)
tf = time.time()
print(round(tf - ts) * 1000)
